#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPushButton>
#include<QRadioButton>
#include<QCheckBox>
#include<QPlainTextEdit>
#include<QFont>
#include<QMessageBox>
#include<QDebug>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    initFont();

    // 从ui对象中获取各个控件，通过控件的objectName
    ui->plainTextEdit->setPlainText("Hello world!");
    ui->plainTextEdit->setFont(this->font);

    connect(ui->pushButton_3,&QPushButton::clicked,this,&MainWindow::close);
    connect(ui->pushButton,&QPushButton::clicked,this,&MainWindow::sure);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::initFont()
{
    QFont qf("宋体");
    qf.setItalic(false);
    qf.setBold(false);
    qf.setPointSize(20);

    font = qf;
}

void MainWindow::sure()
{

   QMessageBox::information(this, "提示信息", "确定按钮被点击");
}

void MainWindow::cancle()
{
    QMessageBox::information(this, "提示信息", "取消按钮被点击");
}

